package com.wdc.controller;


import com.wdc.annotaion.GlobalInterceptor;
import com.wdc.entity.dto.TokenUserInfoDto;
import com.wdc.entity.dto.UserContactSearchResultDto;
import com.wdc.entity.vo.ResponseVo;
import com.wdc.service.UserContactApplyService;
import com.wdc.service.UserContactService;
import com.wdc.service.UserInfoService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.constraints.NotEmpty;

@RestController
@RequestMapping("/contract")
public class UserContractController extends ABaseController{

    @Resource
    private UserContactService userContactService;

    @Resource
    private UserInfoService userInfoService;

    @Resource
    private UserContactApplyService userContactApplyService;

    @RequestMapping("/search")
    @GlobalInterceptor
    public ResponseVo search(HttpServletRequest request, @NotEmpty String contactId) {
        TokenUserInfoDto tokenUserInfoDto = getTokenUserInfo(request);
        UserContactSearchResultDto resultDto = userContactService.searchContact(tokenUserInfoDto.getUserId(), contactId);
        return getSuccessResponseVo(resultDto);
    }


}
